package jhta;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Vector;

import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.JComboBox;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JLayeredPane;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.UIManager;

import java.awt.Color;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.text.Format;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import net.sourceforge.jdatepicker.impl.JDatePanelImpl;//달력추가
import net.sourceforge.jdatepicker.impl.JDatePickerImpl;//달력추가
import net.sourceforge.jdatepicker.impl.UtilDateModel;//달력추가
import javax.swing.SpringLayout;//달력추가2

public class RentInput extends JInternalFrame {
	
	JavaDBConnection main=new JavaDBConnection();//db연결 목적 12
	Main mm;//메인으로 RentUpdate연결하기위해(table갱신 목적)
	int type=0;//택스트창에 표시하기 위해
	String man="";//관리자 저장하기위해
	String bookcode;//도서정보
	String membercode;//회원정보
	//String aa;//과정 콤보박스에서 과정명 가저온다
	//String booktype;//도서분류의 소분류 이름 가져온다
	
	SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
	String str = sf.format(new Date());
	Calendar c= Calendar.getInstance();//반납예정일을 자동으로 구해주기 위해서
	
	DefaultTableModel model2;
	DefaultTableModel model3;
	private JLabel lblNewLabel_1;
	private JLabel lblNewLabel_2;
	private JLabel lblNewLabel_4;
	private JButton btnNewButton;
	private JFormattedTextField ld;
	private JLabel lblNewLabel_5;
	private JComboBox comboBox;
	private JLabel label;
	private JScrollPane scrollPane;
//	private JTable table;
	private JLayeredPane layeredPane;
	private JLayeredPane layeredPane_1;
	private JLabel lblNewLabel_7;
	private JLabel label_2;
	private JLayeredPane layeredPane_2;
	private JLabel label_3;
	private JLayeredPane layeredPane_3;
	private JLayeredPane layeredPane_4;
	private JFormattedTextField ed;
	private JFormattedTextField wd;
	private JFormattedTextField bookname;
	private JFormattedTextField member;
	private JComboBox comboBox_1;
	private JComboBox small;
	private JTable table_1;
	private JFormattedTextField formattedTextField;
	private JButton button;
	private JDatePickerImpl datePicker;//달력 추가
	private JDatePickerImpl datePicker2;//달력 추가
	private JDatePickerImpl datePicker3;//달력 추가
	private SpringLayout springLayout;//달력2 추가
	private JLabel label_1;


	public RentInput(Main m) {
		super("대여정보 입력", false, true, false, true);
		setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
		setBounds(100, 100, 467, 397);
		getContentPane().setLayout(null);
		getContentPane().add(getBtnNewButton());
		getContentPane().add(getLayeredPane_1());
		getContentPane().add(getLayeredPane_1_1());
		getContentPane().add(getLayeredPane_2());
		getContentPane().add(getLayeredPane_3());
		getContentPane().add(getLayeredPane_4());
		getContentPane().add(getButton());
		
		//반납예정일 날짜 자동으로 구해주기
		try{
			c.setTime(sf.parse(str));
			c.add(Calendar.DATE, 7);
			String str2=sf.format(c.getTime());
			ed.setText(str2);
		}catch(Exception ex){
			
		}
		this.mm=m;
		//main.connect();//db연결

	}
	private JLabel getLblNewLabel_1() {
		if (lblNewLabel_1 == null) {
			lblNewLabel_1 = new JLabel("대여인");
			lblNewLabel_1.setBounds(5, 63, 43, 15);
			lblNewLabel_1.setHorizontalAlignment(SwingConstants.RIGHT);
		}
		return lblNewLabel_1;
	}
	private JLabel getLblNewLabel_2() {
		if (lblNewLabel_2 == null) {
			lblNewLabel_2 = new JLabel("도서명");
			lblNewLabel_2.setBounds(5, 98, 43, 15);
			lblNewLabel_2.setHorizontalAlignment(SwingConstants.RIGHT);
		}
		return lblNewLabel_2;
	}
	private JLabel getLblNewLabel_4() {
		if (lblNewLabel_4 == null) {
			lblNewLabel_4 = new JLabel("작성일");
			lblNewLabel_4.setBounds(5, 97, 43, 15);
			lblNewLabel_4.setHorizontalAlignment(SwingConstants.RIGHT);
		}
		return lblNewLabel_4;
	}
	private JButton getBtnNewButton() {
		if (btnNewButton == null) {
			btnNewButton = new JButton("대여 정보 등록");
			btnNewButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					save();
					mm.rUpdate.type();
				}
			});
			btnNewButton.setBounds(310, 290, 113, 68);
		}
		return btnNewButton;
	}
	private JFormattedTextField getLd() {
		if (ld == null) {
			try{
				ld = new JFormattedTextField(sf);
				ld.setHorizontalAlignment(SwingConstants.CENTER);
				ld.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseClicked(MouseEvent arg0) {
					}
				});
				ld.setBounds(80, 19, 77, 28);
				ld.setText(str);//오늘 날짜로 입력
			}catch(Exception ex){}
		}
		return ld;
	}
	private JLabel getLblNewLabel_5() {
		if (lblNewLabel_5 == null) {
			lblNewLabel_5 = new JLabel("과정명");
			lblNewLabel_5.setBounds(5, 26, 43, 15);
			lblNewLabel_5.setHorizontalAlignment(SwingConstants.RIGHT);
		}
		return lblNewLabel_5;
	}
	private JComboBox getComboBox() {
		if (comboBox == null) {
			comboBox = new JComboBox();
			comboBox.addItem("선택하시오");
			type();
			comboBox.addItemListener(new ItemListener() {
				public void itemStateChanged(ItemEvent ee) {//콤보박스 안에 내용 클릭시
					String aa=(String) ee.getItem();//클릭한 이름 저장
					//콤보박스 회원클릭시 정보출력
					membercode="select name, phone from bookmember b inner join code c on c.code_no=b.code_no where c.code_name='"+aa+"'";
					RentInput.this.membercode=membercode;
					tTable();
				}
			});
			comboBox.setBounds(57, 21, 144, 26);
			
		}
		return comboBox;
	}
	private JLabel getLabel() {
		if (label == null) {
			label = new JLabel("이름");
			label.setBounds(5, 29, 31, 15);
			label.setHorizontalAlignment(SwingConstants.RIGHT);
		}
		return label;
	}
	private JScrollPane getScrollPane() {
		if (scrollPane == null) {
			scrollPane = new JScrollPane();
			scrollPane.setBounds(12, 20, 245, 100);
			//scrollPane.setViewportView(getTable_1());
			
		}
		return scrollPane;
	}
	private JLayeredPane getLayeredPane_1() {
		if (layeredPane == null) {
			layeredPane = new JLayeredPane();
			layeredPane.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "\uAE30\uBCF8\uC815\uBCF4", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
			layeredPane.setBounds(12, 10, 213, 130);
			layeredPane.add(getLblNewLabel_5());
			layeredPane.add(getComboBox());
			layeredPane.add(getLblNewLabel_1());
			layeredPane.add(getLblNewLabel_2());
			layeredPane.add(getBookname());
			layeredPane.add(getMember());
		}
		return layeredPane;
	}
	private JLayeredPane getLayeredPane_1_1() {
		if (layeredPane_1 == null) {
			layeredPane_1 = new JLayeredPane();
			layeredPane_1.setBorder(new TitledBorder(null, "\uBD84\uB958", TitledBorder.LEADING, TitledBorder.TOP, null, null));
			layeredPane_1.setBounds(12, 168, 154, 98);
			layeredPane_1.add(getLblNewLabel_7());
			layeredPane_1.add(getLabel_2());
			layeredPane_1.add(getComboBox_4_1());
			layeredPane_1.add(getFormattedTextField());
		}
		return layeredPane_1;
	}
	private JLabel getLblNewLabel_7() {
		if (lblNewLabel_7 == null) {
			lblNewLabel_7 = new JLabel("대");
			lblNewLabel_7.setBounds(10, 25, 19, 15);
		}
		return lblNewLabel_7;
	}
	private JLabel getLabel_2() {
		if (label_2 == null) {
			label_2 = new JLabel("소");
			label_2.setBounds(10, 62, 19, 15);
		}
		return label_2;
	}
	private JLayeredPane getLayeredPane_2() {
		if (layeredPane_2 == null) {
			layeredPane_2 = new JLayeredPane();
			layeredPane_2.setBorder(new TitledBorder(null, "\uC77C\uC790", TitledBorder.LEADING, TitledBorder.TOP, null, null));
			layeredPane_2.setBounds(229, 10, 210, 130);
			layeredPane_2.add(getLd());
			layeredPane_2.add(getLblNewLabel_4());
			layeredPane_2.add(getLabel_3());
			layeredPane_2.add(getFormattedTextField_2_1());
			layeredPane_2.add(getFormattedTextField_1_1());
			layeredPane_2.add(getDatePicker());
			layeredPane_2.add(getDatePicker2());
			layeredPane_2.add(getDatePicker3());
			layeredPane_2.add(getLabel_1());
		}
		return layeredPane_2;
	}
	private JLabel getLabel_3() {
		if (label_3 == null) {
			label_3 = new JLabel("반납예정일");
			label_3.setHorizontalAlignment(SwingConstants.CENTER);
			label_3.setBounds(5, 61, 77, 15);
		}
		return label_3;
	}
	private JLayeredPane getLayeredPane_3() {
		if (layeredPane_3 == null) {
			layeredPane_3 = new JLayeredPane();
			layeredPane_3.setBorder(new TitledBorder(null, "\uAC80\uC0C9\uC815\uBCF4", TitledBorder.LEADING, TitledBorder.TOP, null, null));
			layeredPane_3.setBounds(170, 150, 269, 130);
			layeredPane_3.add(getScrollPane());
		}
		return layeredPane_3;
	}
	private JLayeredPane getLayeredPane_4() {
		if (layeredPane_4 == null) {
			layeredPane_4 = new JLayeredPane();
			layeredPane_4.setBorder(new TitledBorder(null, "\uAD00\uB9AC\uC790", TitledBorder.LEADING, TitledBorder.TOP, null, null));
			layeredPane_4.setBounds(12, 291, 154, 67);
			layeredPane_4.add(getLabel());
			layeredPane_4.add(getComboBox_1());
		}
		return layeredPane_4;
	}
	private JFormattedTextField getFormattedTextField_2_1() {
		if (ed == null) {
			ed = new JFormattedTextField((Format) null);
			ed.setHorizontalAlignment(SwingConstants.CENTER);
			ed.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent arg0) {
				}
			});
			ed.setBounds(80, 55, 77, 28);
		}
		return ed;
	}
	private JFormattedTextField getFormattedTextField_1_1() {
		if (wd == null) {
			wd = new JFormattedTextField((Format) null);
			wd.setHorizontalAlignment(SwingConstants.CENTER);
			wd.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent arg0) {
				}
			});
			wd.setText(str);
			wd.setBounds(80, 91, 77, 28);
		}
		return wd;
	}
	private JFormattedTextField getBookname() {
		if (bookname == null) {
			bookname = new JFormattedTextField((Format) null);
			bookname.addKeyListener(new KeyAdapter() {
				@Override
				public void keyPressed(KeyEvent ev) {
					if(ev.getKeyCode()==KeyEvent.VK_ENTER){//도서명 그냥 엔터치면 모든 도서이름 , 소분류 선택후 이름 쓰면 지정된 도서이름나옴
						if(!bookname.getText().equals("")){
							if(small.getSelectedItem().equals("선택하시오")){
								bookcode="select name, no from book where name like'%"+bookname.getText()+"%'";
								tTable2();//테이블
							}else{
								bookcode="select name, phone from bookmember b inner join code c on c.code_no=b.code_no where c.code_name='"+bookcode+"' and name like'%"+bookname.getText()+"%'";
								tTable2();//테이블
							}
						}else{
							JOptionPane.showMessageDialog(null,"도서명을 적어주세요");
						}
					}
				}
			});
			bookname.setBounds(57, 92, 144, 28);
		}
		return bookname;
	}
	private JFormattedTextField getMember() {
		if (member == null) {
			member = new JFormattedTextField((Format) null);
			member.addKeyListener(new KeyAdapter() {
				@Override
				public void keyPressed(KeyEvent ev) {//대여인 그냥 엔터치면 모든 사람이름 , 과정명선택후 이름 쓰면 지정된 이름나옴
					if(ev.getKeyCode()==KeyEvent.VK_ENTER){
						if(!member.getText().equals("")){
							if(comboBox.getSelectedItem().equals("선택하시오")){
								membercode="select name, phone from bookmember where name like '%"+member.getText()+"%'";
								tTable();//테이블
							}else{
								//membercode="select name, phone from bookmember b inner join code c on c.code_no=b.code_no where c.code_name='"+aa+"' and name like'%"+member.getText()+"%'";
								membercode="select name, phone from bookmember b inner join code c on c.code_no=b.code_no where c.code_name='"+comboBox.getSelectedItem()+"' and name like'%"+member.getText()+"%'";
								tTable();//테이블
							}
						}else{
							JOptionPane.showMessageDialog(null,"이름을 적어주세요");
						}
					}
				}
			});
			member.setBounds(57, 57, 144, 28);
		}
		return member;
	}
	private JComboBox getComboBox_1() {
		if (comboBox_1 == null) {
			comboBox_1 = new JComboBox();
			comboBox_1.addItem("선택하시오");
			type2();
			comboBox_1.addItemListener(new ItemListener() {
				public void itemStateChanged(ItemEvent ee) {
					man=(String) ee.getItem();//클릭한 이름 저장
				}
			});
			
			comboBox_1.setBounds(48, 24, 94, 26);
			
		}
		return comboBox_1;
	}
	private JComboBox getComboBox_4_1() {
		if (small == null) {
			small = new JComboBox();
			small.addItem("선택하시오");
			type3();
			
			small.addItemListener(new ItemListener() {
				public void itemStateChanged(ItemEvent ee) {
					String booktype=(String) ee.getItem();//클릭한 이름 저장
					//콤보박스 소분류 도서 클릭시 정보출력
					
					String bookcode="select name, no from book b inner join code c on b.code_no=c.code_no where c.code_name='"+booktype+"'";
					RentInput.this.bookcode=bookcode;//추가햇음
					tTable2();//도서 태이블 불러오기 //수정
					
				}
			});
			small.setBounds(38, 56, 104, 26);
		}
		return small;
	}
	private JTable getTable_1() { 
		if (table_1 != null) {
			table_1 = new JTable(model3);
			table_1.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent ee) { //마우스 클릭시
					if(ee.getButton()==1){
						int a=table_1.getSelectedRow();
						
						if(type==1){
							member.setText(model3.getValueAt(a, 0).toString());
						}
						if(type==2){
							bookname.setText(model3.getValueAt(a, 0).toString());
						}
					}
				}
			});
		}
		return table_1;
	}
	
	private JFormattedTextField getFormattedTextField() {
		if (formattedTextField == null) {
			formattedTextField = new JFormattedTextField((Format) null);
			formattedTextField.setEnabled(false);
			formattedTextField.setHorizontalAlignment(SwingConstants.CENTER);
			formattedTextField.setText("도서");
			formattedTextField.setBounds(38, 22, 104, 28);
		}
		return formattedTextField;
	}

	public void save(){
		try{
			String nu="select max(no) from rent";//대여번호
			int nu1=0;//가져온 대여번호 넣기
			int booktot1=0;//가져온 보유도서수량 값
			//int bookcount1=0;//보유도서수량-1한 값
			String me="select no from bookmember m where m.name='"+member.getText()+"'";//대여자번호
			String bn="select no from book b where b.name='"+bookname.getText()+"'";//도서번호
			String lda=ld.getText();//대여일
			String eda=ed.getText();//반납예정일
			String wde=wd.getText();//작성일
			String rn="select no from bookmember m where m.name='"+man+"'";//관리자번호
			
			
					
			//대여번호 가져오기
			PreparedStatement ptmt=main.getConn().prepareStatement(nu);
			ResultSet rs=ptmt.executeQuery();
			if(rs.next()){
				nu1=rs.getInt(1);
			}
			
			ptmt.close();
			rs.close();
			
			//대여자 번호 가져오기
			PreparedStatement ptmt1=main.getConn().prepareStatement(me);
			ResultSet rs1=ptmt1.executeQuery();
			if(rs1.next()){
				me=rs1.getString(1);
			}
			
			ptmt1.close();
			rs1.close();
			
			
			//도서번호 가져오기
			PreparedStatement ptmt2=main.getConn().prepareStatement(bn);
			ResultSet rs2=ptmt2.executeQuery();
			if(rs2.next()){
				bn=rs2.getString(1);
			}
			
			ptmt2.close();
			rs2.close();
			
			//관리자번호 가져오기
			PreparedStatement ptmt3=main.getConn().prepareStatement(rn);
			ResultSet rs3=ptmt3.executeQuery();
			if(rs3.next()){
				rn=rs3.getString(1);
			}
			ptmt3.close();
			rs3.close();
			
			String booktot="select volume from book where no="+bn;//책 현재 보유권수(총 권수 아님)
			
			//책 현재 보유권수(총 권수 아님) 가져오기
			PreparedStatement ptmt4=main.getConn().prepareStatement(booktot);
			ResultSet rs4=ptmt4.executeQuery();
			if(rs4.next()){
				booktot1=rs4.getInt(1);
			}
			
			ptmt4.close();
			rs4.close();
			//현재 보유권수가 0보다 많을 때 빌리는 것 가능
			if(booktot1>0){
				//책빌려갈때 -1하는 것
				String bookcount="update book set volume="+(booktot1-1)+" where no="+bn;//빌려갈때마다 -1함
				
				PreparedStatement ptmt5=main.getConn().prepareStatement(bookcount);
				ResultSet rs5=ptmt5.executeQuery();
				if(rs5.next()){
				}
				
				ptmt5.close();
				rs5.close();
				
				//종합해서 저장하기
				String tot="insert into rent values("+(nu1+1)+","+me+","+bn+","+"to_date('"+lda+"', 'yyyy/mm/dd'),to_date('"+wde+"', 'yyyy/mm/dd'),null,to_date('"+eda+"', 'yyyy/mm/dd'), "+rn+")";
				
				PreparedStatement ptmt6=main.getConn().prepareStatement(tot);
				ResultSet rs6=ptmt6.executeQuery();
				if(rs6.next()){
					JOptionPane.showMessageDialog(null, "저장됨");
				}
				
				ptmt6.close();
				rs6.close();
			}else{
				JOptionPane.showMessageDialog(null, "현재 보유 권수가 없습니다");
			}
			
			
			
		}catch(Exception ex){
			JOptionPane.showMessageDialog(null, "정확하게 입력해주세요");
		}
		

	}
	public void type(){//과정명 가져오기
		try{
			String sql="select code_name from code where code_big='A3' and code_small is not null";
			PreparedStatement ptmt=main.getConn().prepareStatement(sql);
			
			ResultSet rs=ptmt.executeQuery();				
			while(rs.next()){
				comboBox.addItem(rs.getString(1));
			}
			rs.close();
			ptmt.close();
			
		}catch(Exception ex){
			
		}
		
	}
	public void type2(){//관리자 가져오기
		try{
			String sql="select name from bookmember where code_no=2";
			PreparedStatement ptmt=main.getConn().prepareStatement(sql);
			
			ResultSet rs=ptmt.executeQuery();
			while(rs.next()){
				comboBox_1.addItem(rs.getString(1));
			}
			rs.close();
			ptmt.close();
			
		}catch(Exception ex){
			
		}
	}
	
	public void type3(){//소(도서)정보 가져오기
		try{

			String sql="select code_name from code where code_big='A1' and code_small is not null"; //도서 만 가져오기
			PreparedStatement ptmt=main.getConn().prepareStatement(sql);
			
			ResultSet rs=ptmt.executeQuery();
			while(rs.next()){
				small.addItem(rs.getString(1));
			}
			rs.close();
			ptmt.close();
		}catch(Exception ex){
			
		}
	}
	
	public void tTable(){//대여정보 테이블
		try{
			PreparedStatement ptmt=main.getConn().prepareStatement(membercode);
			ResultSet rs=ptmt.executeQuery();
			
			String k2[]={"대여자", "연락처"};
			model3=new DefaultTableModel(k2,0);
			table_1=new JTable(model3);
			
			
			while(rs.next()){	
				Vector vec1=new Vector();
				vec1.add(rs.getString(1));
				vec1.add(rs.getString(2));
				model3.addRow(vec1);
			}		

			type=1;
			
			scrollPane.setViewportView(getTable_1());
			
			rs.close();
			ptmt.close();
			
		}catch(Exception ex){
			
		}
		
	}
	
	public void tTable2(){//도서정보 테이블
		try{
			PreparedStatement ptmt=main.getConn().prepareStatement(bookcode);
			ResultSet rs=ptmt.executeQuery();
			
			String k[]={"도서명", "도서코드"};
			model3=new DefaultTableModel(k,0);
			table_1=new JTable(model3);
			
			
			while(rs.next()){	
				Vector vec1=new Vector();
				vec1.add(rs.getString(1));
				vec1.add(rs.getString(2));
				model3.addRow(vec1);
				//System.out.println(vec1);
			}
			type=2;//텍스트창에 뿌려줄때 위치 구분해주기 위해서

			scrollPane.setViewportView(getTable_1());
			
			rs.close();
			ptmt.close();
			
		}catch(Exception ex){
			
		}
		
	}
	private JButton getButton() {
		if (button == null) {
			button = new JButton("초기화");
			button.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					member.setText("");
					bookname.setText("");
					ld.setText("");
					ed.setText("");
					wd.setText("");
				}
			});
			button.setBounds(200, 311, 88, 47);
		}
		return button;
	}
	
	private JDatePickerImpl getDatePicker(){
		if (datePicker == null) {
			UtilDateModel uModel = new UtilDateModel();
			JDatePanelImpl datePanel = new JDatePanelImpl(uModel);
			datePicker = new JDatePickerImpl(datePanel);
			datePicker.setBorder(null);
			springLayout = (SpringLayout) datePicker.getLayout();
			
			datePicker.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					ld.setText(sf.format((Date)datePicker.getModel().getValue()));
				}
			});
			datePicker.setBackground(UIManager.getColor("Button.background"));
			datePicker.getJFormattedTextField().setVisible(false);
			datePicker.setSize(45, 27);
			datePicker.setLocation(151, 19);
			
		}
		return datePicker;
	}
	
	private JDatePickerImpl getDatePicker2(){
		if (datePicker2 == null) {
			UtilDateModel uModel = new UtilDateModel();
			JDatePanelImpl datePanel = new JDatePanelImpl(uModel);
			datePicker2 = new JDatePickerImpl(datePanel);
			datePicker2.setBorder(null);
			springLayout = (SpringLayout) datePicker2.getLayout();
			
			datePicker2.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					ed.setText(sf.format((Date)datePicker2.getModel().getValue()));
				}
			});
			datePicker2.setBackground(UIManager.getColor("Button.background"));
			datePicker2.getJFormattedTextField().setVisible(false);
			datePicker2.setSize(45, 27);
			datePicker2.setLocation(151, 55);
			
		}
		return datePicker2;
	}
	
	private JDatePickerImpl getDatePicker3(){
		if (datePicker3 == null) {
			UtilDateModel uModel = new UtilDateModel();
			JDatePanelImpl datePanel = new JDatePanelImpl(uModel);
			datePicker3 = new JDatePickerImpl(datePanel);
			datePicker3.setBorder(null);
			springLayout = (SpringLayout) datePicker3.getLayout();
			
			datePicker3.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					wd.setText(sf.format((Date)datePicker3.getModel().getValue()));
				}
			});
			datePicker3.setBackground(UIManager.getColor("Button.background"));
			datePicker3.getJFormattedTextField().setVisible(false);
			datePicker3.setSize(45, 27);
			datePicker3.setLocation(151, 91);
			
		}
		return datePicker3;
	}
	private JLabel getLabel_1() {
		if (label_1 == null) {
			label_1 = new JLabel("대여일자");
			label_1.setHorizontalAlignment(SwingConstants.CENTER);
			label_1.setBounds(3, 25, 69, 15);
		}
		return label_1;
	}
}

